#include <stdio.h>
#include <string.h>

int returnarr(char *arr,int start,int end)
{
	if(start==end)
	{
		return end+1;
	}
	int i=start;
	int j=end-1;
	char temp;
	while(i<j)
	{
		temp=arr[i];
		arr[i]=arr[j];
		arr[j]=temp;
		i++;
		j--;
	}
	
	return end+1;
}

int main(int argc, const char *argv[])
{
	char arr[]="this is a book";
	int arrlen=strlen(arr);
	returnarr(arr,0,arrlen);
	int i=0;
	int start=0;
	while(arr[i]!='\0')	
	{
		if(arr[i]==' ')
		{
			start=returnarr(arr,start,i);
		}
		i++;
	}
	returnarr(arr,start,i);

	printf("%s\n",arr);

	return 0;
}
